#include <iostream>
#include <thread>
#include <atomic>
#include <chrono>
#include <stdint.h>
  int64_t  sharedValue(0);

 bool  keepRunning(true);

void incrementThread() {
    while (keepRunning ) {
        sharedValue++;
        //std::this_thread::sleep_for(std::chrono::milliseconds(100));
    }
}
int64_t i=0;
void readThread() {
    i++;
    while (keepRunning  ) {
        if(sharedValue%100==0)
        std::cout << "Current value: " << sharedValue  << std::endl;
        //std::this_thread::sleep_for(std::chrono::milliseconds(500));
    }
}

int main() {
    std::thread t1(incrementThread);
    std::thread t2(readThread);

    std::cout << "Press Enter to stop..." << std::endl;
    std::cin.get();

    keepRunning=false;

    t1.join();
    t2.join();

    std::cout << "Final value: " << sharedValue << std::endl;

    return 0;
}